
<?php if(!empty($option_list)){?>
<div class="theme-detail-poll-content">
    <form method="post" id="poll_form" <?php if(!$vote_end && !$partake){?> action="<?php echo url('circle/theme/save_votepoll',array('c_id'=>$c_id,'t_id'=>$t_id));?>"<?php }?>>
    <input type="hidden" name="form_submit" value="ok" />
    <div class="poll-option-info">
        <h4>
            <?php if($poll_info['poll_multiple'] == 1){echo 多选投票;}else{echo 单选投票;}?>
        </h4>
        <?php echo 共有;?><em><?php echo $poll_info['poll_voters'];?></em><?php echo 人参与投票;?>
        <h5>
            <?php if($vote_end){echo （投票结束）;}else if($partake){echo （已经参与）;}?>
        </h5>
    </div>
    <table width="100%" border=0 cellpadding="0" cellspacing="0">
        <?php $i = 0;foreach (($option_list) as $val){ $i++;?>
        <tr>
            <td class="w20"><?php if($poll_info['poll_multiple'] == 1){?>
                <input type="checkbox" name="pollopid[]" value="<?php echo $val['pollop_id'];?>" <?php if($vote_end || $partake || !in_array($identity, array(1,2,3))){?>disabled="disabled"<?php }?> />
                <?php }else{?>
                <input type="radio" name="pollopid[]" value="<?php echo $val['pollop_id'];?>" <?php if($vote_end || $partake || !in_array($identity, array(1,2,3))){?>disabled="disabled"<?php }?> />
                <?php }?></td>
            <td class="w150"><?php echo $val['pollop_option'];?></td>
            <td class="w230"><div class="poll-column">
                <p class="c<?php echo $i;?>" style="width: <?php echo intval($poll_info['poll_voters']) != 0?sprintf('%.2f%%', intval($val['pollop_votes'])/intval($poll_info['poll_voters'])*100):0;?>"> </p>
                <i> <?php echo intval($poll_info['poll_voters']) != 0?sprintf('%.2f%%', intval($val['pollop_votes'])/intval($poll_info['poll_voters'])*100):'0.00%';?></i></div></td>
            <td><?php if($val['pollop_votername'] != ''){?>
                <span><?php echo recentlyTwoVoters($val['pollop_votername']);?>&nbsp;<?php echo 等;?></span>
                <?php }?>
                <em><?php echo $val['pollop_votes'];?></em><?php echo 人已投票;?></td>
        </tr>
        <?php }?>
    </table>
    <?php if(!$vote_end && !$partake && in_array($identity, array(1,2,3))){?>
    <div class="bottom"><a href="javascript:void(0);" nctype="poll_submit" class="btn" ><?php echo 提交;?></a><span nctype="poll-warning" class="warning"></span> </div>
    <?php }?>
    </form>
</div>
<script>
    var c_id = <?php echo $c_id;?>;
    var t_id = <?php echo $t_id;?>;
    $(function(){
        <?php if(!$vote_end && !$partake){?>
	$('a[nctype="poll_submit"]').click(function(){
            if(_ISLOGIN){
            if($('input[name="pollopid[]"]:checked').length == 0){
            $('span[nctype="poll-warning"]').html('请选择投票选项').show();
            window.setTimeout(pollWarningHide,5000);	// 5 seconds after the hidden message
            return false;
        }
            ajaxpost('poll_form', "{:url('circle/theme/save_votepoll')}?c_id="+c_id+"&t_id="+t_id, '', 'onerror');
        }else{
            login_dialog();
        }
        });
	<?php }?>
        });
    function pollWarningHide(){
        $('span[nctype="poll-warning"]').hide('slow').html('');
    }
</script>
<?php }?>
